﻿<UserControl x:Class="ThumbGen.MaxFilesizeControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:ThumbGen"
             >
    <UserControl.Resources>
        <ResourceDictionary>
            <local:BoolNotConverter x:Key="BoolNotConverter"/>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/CommonStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <!--{Binding Source={x:Static local:FileManager.Configuration}, Path=Options.MovieSheetsOptions.TVShowsLanguage}-->
    <GroupBox x:Name="TheGroupBox" Header="Maximum Filesize" Style="{StaticResource GroupBoxStyle}" Margin="5" IsEnabled="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}},Path=IsEnabled}">
        <StackPanel Orientation="Vertical">
            <RadioButton Margin="5" IsChecked="{Binding Path=IsMaxQuality, Mode=TwoWay}" ToolTip="If checked then the image will be rendered at max quality">
                <TextBlock Text="No limit (max. quality)"/>
            </RadioButton>
            <RadioButton Margin="5" IsChecked="{Binding Path=IsMaxQuality, Mode=TwoWay, Converter={StaticResource BoolNotConverter}}"
                         ToolTip="If checked then the image quality will be reduced to fit the specified filesize">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Margin="2 0 5 0" HorizontalAlignment="Left" Text="Limit to:" VerticalAlignment="Center"/>
                    <TextBox Width="50" Text="{Binding Path=LimitBytes, Mode=TwoWay, FallbackValue=50000}" VerticalAlignment="Center"/>
                    <TextBlock Margin="5 0 0 0" HorizontalAlignment="Left" Text="bytes" VerticalAlignment="Center"/>
                </StackPanel>
            </RadioButton>
        </StackPanel>
    </GroupBox>
</UserControl>
